﻿<UserControl x:Class="DaphneControls.PDNTagEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             xmlns:local="clr-namespace:DaphneControls.ViewModel"             
             xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4"
             >
    <UserControl.DataContext>
        <local:PDNTagEditorVM />
    </UserControl.DataContext>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Button x:Name="uxAddButton" Grid.Row="0" Width="100" Height="20" Margin="3" HorizontalAlignment="Right" Command="{Binding Path=AddPDNTag}">New PDN Tag</Button>
        <DataGrid Grid.Row="1" AutoGenerateColumns="False" HeadersVisibility="Column"  HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch"
                    ItemsSource="{Binding Path=TagRecords}" CanUserAddRows="False" CanUserResizeColumns="True" CellEditEnding="DataGrid_CellEditEnding"  >
            <DataGrid.Columns>
                <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=TagHeader}" Width="0.25*" FontWeight="Bold" />
                <DataGridTextColumn IsReadOnly="False" Width="0.75*" Binding="{Binding Path=TagContent, Mode=TwoWay}"  />
                <DataGridTemplateColumn Width="80">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Command="{Binding Path=DeleteCommand}" CommandParameter="{Binding Path=CommandParameter}" >Delete</Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</UserControl>
